Option Strict Off
Option Explicit On
Namespace BMLERP
	Friend Class frmDelUser
		Inherits System.Windows.Forms.Form

		Private Sub frmDelUser_Activated(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Activated
			Adodc1.ConnectionString = ConnectString
			Adodc1.CommandTimeout = 10
			Adodc1.CommandType = ADODB.CommandTypeEnum.adCmdText
			Adodc1.RecordSource = "Select Users.* from Users WHERE (((Users.UserName)<>'' And (Users.UserName) Is Not Null))"
			Adodc1.Refresh()
			If Adodc1.Recordset.RecordCount > 0 Then
				Adodc1.Recordset.MoveFirst()
				cbouser.CtlText = Adodc1.Recordset.Fields("UserName").Value
				lblName.Text = Adodc1.Recordset.Fields("Name").Value
			End If

		End Sub

		Private Sub cmdDelete_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdDelete.Click
			Dim cmdExecute As Object

			cmdExecute = New ADODB.Command
			cmdExecute.ActiveConnection = DBconn
			cmdExecute.CommandText = ("UPDATE Users SET UserGroup = 0 " & " , UserName='' , password =''" & " WHERE UserName='" & cbouser.CtlText & "'")
			cmdExecute.Execute()

			Adodc1.Refresh()
			cbouser.ReFill()
			If Adodc1.Recordset.RecordCount > 0 Then
				Adodc1.Recordset.MoveFirst()
				lblName.Text = Adodc1.Recordset.Fields("Name").Value
				cbouser.CtlText = Adodc1.Recordset.Fields("UserName").Value
			End If

		End Sub

		Private Sub cmdExit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdExit.Click
			Me.Close()

		End Sub



		Private Sub cbouser_ClickEvent(ByVal eventSender As System.Object, ByVal eventArgs As AxMSDataListLib.DDataComboEvents_ClickEvent) Handles cbouser.ClickEvent
			If eventArgs.area = 2 Then
				With Adodc1.Recordset
					.MoveFirst()
					Do Until .Fields("UserName").Value = cbouser.CtlText
						.MoveNext()
					Loop
				End With
				lblName.Text = Adodc1.Recordset.Fields("Name").Value

			End If
		End Sub

		Private Sub frmDelUser_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
			Adodc1.ConnectionString = ConnectString
			Adodc1.CommandTimeout = 10
			Adodc1.CommandType = ADODB.CommandTypeEnum.adCmdText
			Adodc1.RecordSource = "Select Users.* from Users WHERE (((Users.UserName)<>'' And (Users.UserName) Is Not Null))"
			Adodc1.Refresh()
			VB6_AddADODataBinding()
			cbouser.RowSource = ADOBind_Adodc1.DataSource
		End Sub
	End Class
End Namespace